#ifndef SLEPFILETABLE_H
#define SLEPFILETABLE_H

#include <QWidget>
#include <QSortFilterProxyModel>
#include <QTreeView>
#include <QAbstractItemModel>
#include <QStandardItemModel>
#include <QGroupBox>
#include <QDockWidget>
#include "slepfileoperations.h"

QT_BEGIN_NAMESPACE
    class QPushButton;
QT_END_NAMESPACE




class SLEPFileTable : public QWidget
{
    Q_OBJECT

public:
    SLEPFileTable( QWidget *parent = 0 );
    ~SLEPFileTable();

    int getSelection();
    int getSelectionType(int selection);
    void getDenseMatrix(int selection, int *m, int *n, double **data);
    void getDenseVector(int selection, int *dimension, double **data);
    void getSparseVector(int selection, int *nnz, double **data, int **index);
    void getSingleValue(int selection, double *value);
	void getGroupIndices(int selection, int *size,int **indices);
    QStandardItemModel* getItemModel();
    QList<SLEPItem>* getSlepItemList();
    void setModel(QStandardItemModel* model,QList<SLEPItem>* list);

public slots:
    void actAddMatrix();
    void actAddVector();
	void actAddGroupIndices();
    void actAddRandomData();
    void actRemove();
    void actView();

private:
    int whatItemIsFile(QString filename);
    void readItemFromFile(QString filename, SLEPItem *item);

private:
    QPushButton *buttonAddMatrix;
    QPushButton *buttonAddVector;
    QPushButton *buttonAddRandomData;
    QPushButton *buttonRemove;
    QPushButton *buttonView;


    QTreeView *treeView;
    QStandardItemModel *itemModel;
    QList<SLEPItem> *slepItemList;

    QItemSelectionModel *selection;
};




#endif // SLEPFILETABLE_H
